package lab.southpark.demo.services.fake.user
{
	import com.southpark.demo.services.ServerErrorCodes;
	import com.southpark.framework.control.proxies.IProxy;
	
	import lab.southpark.demo.services.fake.BaseFakeService;
	import lab.southpark.demo.services.fake.FakeFaultEvent;
	import lab.southpark.demo.services.fake.FakeResultEvent;
	
	import mx.rpc.Fault;
	
	
	public class FakeUserLoginService extends BaseFakeService
	{	
       
		public function FakeUserLoginService(proxy:IProxy)
		{
   			super(proxy);
   			delay = 1000;
		}

        override protected function fakeExecute():void
        {
        	if (paramters.length == 2 && paramters[1] == "")
        	{
        		var faultEvent:FakeFaultEvent = new FakeFaultEvent();
	        	faultEvent.fault = new Fault(ServerErrorCodes.ERROR_0001,null);
	        	
	        	proxy.onServiceFault(faultEvent);
	        	
	        	return;
        	};
        	
        	var resultEvent:FakeResultEvent = new FakeResultEvent();
        	resultEvent.result = {sessionId:new Date().toString()};
        	
        	proxy.onServiceSuccess(resultEvent);
        }

	}
}